<template>
  <div id="app">
    <header class="header">
      <div class="container">
        <div class="logo">
          <router-link to="/">我的博客</router-link>
        </div>
        <nav class="nav">
          <router-link to="/" class="nav-link" active-class="active">首页</router-link>
          <router-link to="/posts" class="nav-link" active-class="active">文章</router-link>
          <router-link to="/profile" class="nav-link" active-class="active">关于我</router-link>
          <router-link to="/about" class="nav-link" active-class="active">关于博客</router-link>
          <router-link to="/contact" class="nav-link" active-class="active">联系</router-link>
        </nav>
        <div class="search-box">
          <input 
            type="text" 
            placeholder="搜索文章..." 
            v-model="searchQuery" 
            @keyup.enter="performSearch"
            class="search-input"
          />
          <button @click="performSearch" class="search-button">搜索</button>
        </div>
      </div>
    </header>
    <main class="main">
      <div class="container">
        <router-view />
      </div>
    </main>
    <footer class="footer">
      <div class="container">
        <div class="footer-content">
          <div class="footer-section">
            <h3>关于博客</h3>
            <p>这是一个现代化、美观且功能完整的Vue 3个人博客模板，使用Vite构建。它专注于性能和用户体验，包含了响应式设计、文章分类、标签系统、搜索功能以及个人资料展示等完整的博客功能。博客具有直观的导航结构，包括首页、文章列表、分类页面、标签页面、文章详情页面、个人资料页面、关于页面和联系页面等核心功能模块。</p>
          </div>
          <div class="footer-section">
            <h3>快速链接</h3>
            <ul class="footer-links">
              <li><router-link to="/">首页</router-link></li>
              <li><router-link to="/posts">文章</router-link></li>
              <li><router-link to="/profile">关于我</router-link></li>
              <li><router-link to="/contact">联系</router-link></li>
            </ul>
          </div>
          <div class="footer-section">
            <h3>联系我</h3>
            <p>邮箱: example@example.com</p>
            <p>GitHub: github.com/example</p>
          </div>
        </div>
        <div class="footer-bottom">
          <p>&copy; 2025 个人博客. All rights reserved.</p>
        </div>
      </div>
    </footer>
  </div>
</template>

<script>
import { ref } from 'vue'
import { useRouter } from 'vue-router'

export default {
  name: 'App',
  setup() {
    const router = useRouter()
    const searchQuery = ref('')
    
    const performSearch = () => {
      if (searchQuery.value.trim()) {
        router.push(`/search?q=${encodeURIComponent(searchQuery.value.trim())}`)
      }
    }
    
    return {
      searchQuery,
      performSearch
    }
  }
}
</script>

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f8f9fa;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background-color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 20px;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo a {
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
  color: #42b983;
}

.nav {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  text-decoration: none;
  color: #333;
  font-weight: 600;
  transition: all 0.3s;
  position: relative;
  padding: 0.5rem 0;
}

.nav-link:hover {
  color: #667eea;
}

.nav-link.active {
  color: #667eea;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(to right, #667eea, #764ba2);
  border-radius: 3px;
}

.search-box {
  display: flex;
  gap: 0.5rem;
}

.search-input {
  padding: 0.8rem 1rem;
  border: 2px solid #eee;
  border-radius: 30px;
  font-size: 1rem;
  transition: all 0.3s;
  min-width: 200px;
}

.search-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-button {
  padding: 0.8rem 1.5rem;
  background: linear-gradient(to right, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s;
  box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.search-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(102, 126, 234, 0.4);
}

.search-button:active {
  transform: translateY(0);
}

/* Main */
.main {
  flex: 1;
  padding: 2rem 0;
}

/* Footer */
.footer {
  background: linear-gradient(135deg, #2c3e50 0%, #1a1a2e 100%);
  color: #ecf0f1;
  padding: 3rem 0 1rem;
  margin-top: auto;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h3 {
  color: #667eea;
  margin-bottom: 1rem;
  font-size: 1.3rem;
  position: relative;
  padding-bottom: 0.5rem;
}

.footer-section h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 3px;
  background: linear-gradient(to right, #667eea, #764ba2);
  border-radius: 3px;
}

.footer-section p {
  line-height: 1.6;
  color: #bdc3c7;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.8rem;
}

.footer-links a {
  color: #bdc3c7;
  text-decoration: none;
  transition: all 0.3s;
}

.footer-links a:hover {
  color: #667eea;
  padding-left: 5px;
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #95a5a6;
  font-size: 0.9rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .header .container {
    flex-direction: column;
    gap: 1rem;
  }
  
  .nav {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .search-box {
    width: 100%;
    max-width: 300px;
  }
  
  .search-input {
    flex: 1;
  }
  
  .logo a {
    font-size: 1.8rem;
  }
}
</style>